<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function User(){this.name="tom";};
        User.prototype.age=19;

        var tom=new User();
        //tom对象中是否存在名为age的自有属性（非原型链获取）
        console.log(tom.hasOwnProperty("age"));  //false
        console.log(tom.hasOwnProperty("name"));  //true
        console.log("age" in tom);
    </script>
</body>
</html>